/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://</a>
 */
package cn.rokhdelar.umbrsapi.core.utils;



import lombok.Data;

import java.io.Serializable;

/**
 * <pre>
 * 	因为使用泛型的原因才能生成api参数说明，所以有两个数据对象data和datalist
 * 	如果是单类的业务对象请使用data
 * 	如果是List<T> 的业务对象请使用dataList
 * </pre>
 */
@Data
public class Result implements Serializable {

	private static final long serialVersionUID = 1L;
	private boolean success;
	private Integer code;
	private String msg;
	/**
	 * 当返回的数据为单对象是实用此属性
	 */
	private Object data;




	public Result() {
		this.code=200;
		this.msg = "成功";
		this.success = true;
	}
	
	public Result(Object data) {
		this.code=200;
		this.msg = "成功";
		this.data= data;
		this.success = true;
	}
	
	public Result success(){
		Result result=new Result();
		result.code = 200;
		result.msg = "成功";
		result.success = true;
		return result;
	}
	
	/**
	 * 自定义消息提示，建议使用枚举类（StatusCode）传参
	 * <p>Title: success</p>  
	 * <p>Description: </p>  
	 * @author liucy   
	 * @date 2023年12月7日  
	 * @param msg
	 * @return
	 */
	public Result success(String msg){
		Result result=new Result();
		result.code = 200;
		result.msg = msg;
		result.success = true;
		return result;
	}

	public Result success(Object data){
		Result result=new Result();
		result.code = 200;
		result.msg = msg;
		this.data= data;
		result.success = true;
		return result;
	}
	

	

	

	

}
